home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.n
/
regsub.n
< prev
next >
Wrap
Text File
|
1995-07-25
|
5KB
|
133 lines
rrrreeeeggggssssuuuubbbb((((nnnn)))) TTTTccccllll (((( )))) rrrreeeeggggssssuuuubbbb((((nnnn))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
regsub - Perform substitutions based on regular expression
pattern matching
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
rrrreeeeggggssssuuuubbbb ?_s_w_i_t_c_h_e_s? _e_x_p _s_t_r_i_n_g _s_u_b_S_p_e_c _v_a_r_N_a_m_e
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
This command matches the regular expression _e_x_p against
_s_t_r_i_n_g, and it copies _s_t_r_i_n_g to the variable whose name is |
given by _v_a_r_N_a_m_e. The command returns 1 if there is a match |
and 0 if there isn't. If there is a match, then while |
copying _s_t_r_i_n_g to _v_a_r_N_a_m_e the portion of _s_t_r_i_n_g that matched
_e_x_p is replaced with _s_u_b_S_p_e_c. If _s_u_b_S_p_e_c contains a ``&''
or ``\0'', then it is replaced in the substitution with the
portion of _s_t_r_i_n_g that matched _e_x_p. If _s_u_b_S_p_e_c contains a
``\_n'', where _n is a digit between 1 and 9, then it is
replaced in the substitution with the portion of _s_t_r_i_n_g that
matched the _n-th parenthesized subexpression of _e_x_p.
Additional backslashes may be used in _s_u_b_S_p_e_c to prevent
special interpretation of ``&'' or ``\0'' or ``\_n'' or
backslash. The use of backslashes in _s_u_b_S_p_e_c tends to
interact badly with the Tcl parser's use of backslashes, so
it's generally safest to enclose _s_u_b_S_p_e_c in braces if it
includes backslashes.
If the initial arguments to rrrreeeeggggeeeexxxxpppp start with ---- then they |
are treated as switches. The following switches are |
currently supported: |
----aaaallllllll ||
All ranges in _s_t_r_i_n_g that match _e_x_p are found and |
substitution is performed for each of these |
ranges. Without this switch only the first |
matching range is found and substituted. If ----aaaallllllll |
is specified, then ``&'' and ``\_n'' sequences are |
handled for each substitution using the |
information from the corresponding match. |
----nnnnooooccccaaaasssseeee ||
Upper-case characters in _s_t_r_i_n_g will be converted |
to lower-case before matching against _e_x_p; |
however, substitutions specified by _s_u_b_S_p_e_c use |
the original unconverted form of _s_t_r_i_n_g. |
-------- ||
Marks the end of switches. The argument following |
this one will be treated as _e_x_p even if it starts |
Page 1 (printed 7/17/95)
rrrreeeeggggssssuuuubbbb((((nnnn)))) TTTTccccllll (((( )))) rrrreeeeggggssssuuuubbbb((((nnnn))))
with a ----....
See the manual entry for rrrreeeeggggeeeexxxxpppp for details on the
interpretation of regular expressions.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
match, pattern, regular expression, substitute
Page 2 (printed 7/17/95)